package com.firefightingiot.firefightingiot.web.web;

import cn.hutool.json.JSONObject;
import com.firefightingiot.firefightingiot.common.base.BaseController;
import com.firefightingiot.firefightingiot.support.annotaion.Action;
import com.firefightingiot.firefightingiot.support.annotaion.At;
import com.firefightingiot.firefightingiot.support.model.RespEntity;
import com.firefightingiot.firefightingiot.web.service.UltrasonicDeviceNormalLogService;
import com.firefightingiot.firefightingiot.web.service.UltrasonicService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import java.text.ParseException;

/**
 * @Author: YangYu
 * @ClassName: UltrasonicController
 * @Date: Created in 9:17 2022/10/8
 * @Description: 超声波水表控制器
 */
@Action
@RequestMapping(value = "ultrasonic")
public class UltrasonicController extends BaseController {

    @Resource
    private UltrasonicService ultrasonicService;
    @Resource
    private UltrasonicDeviceNormalLogService ultrasonicDeviceNormalLogService;
    /**
     * @Author YangYu
     * @Description 组新增、编辑
     * @Date Created in 9:37 2022/10/8
     * @Param [jsonParam]
     */
    @At(value = "groupAddOrUpdate", method = RequestMethod.POST)
    public RespEntity groupAddOrUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return ultrasonicService.groupAddOrUpdate(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 组删除
     * @Date Created in 9:37 2022/10/8
     * @Param [jsonParam]
     */
    @At(value = "groupDel", method = RequestMethod.POST)
    public RespEntity groupDel(@RequestBody(required = false) JSONObject jsonParam) {
        return ultrasonicService.groupDel(jsonParam);
    }
    /**
     * @Author YangYu
     * @Description 组列表
     * @Date Created in 9:37 2022/10/8
     * @Param [jsonParam]
     */
    @At(value = "groupList", method = RequestMethod.GET)
    public RespEntity groupList(@RequestBody(required = false) JSONObject jsonParam) {
        return ultrasonicService.groupList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 超声波设备新增、编辑
     * @Date Created in 9:37 2022/10/8
     * @Param [jsonParam]
     */
    @At(value = "ultrasonicDeviceAddOrUpdate", method = RequestMethod.POST)
    public RespEntity ultrasonicDeviceAddOrUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return ultrasonicService.ultrasonicDeviceAddOrUpdate(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 超声波设备删除
     * @Date Created in 9:37 2022/10/8
     * @Param [jsonParam]
     */
    @At(value = "ultrasonicDeviceDel", method = RequestMethod.POST,param = {"id"})
    public RespEntity ultrasonicDeviceDel(@RequestBody(required = false) JSONObject jsonParam) {
        return ultrasonicService.ultrasonicDeviceDel(jsonParam);
    }
    /**
     * @Author YangYu
     * @Description 超声波设备详情
     * @Date Created in 9:37 2022/10/8
     * @Param [jsonParam]
     */
    @At(value = "ultrasonicDeviceDetail", method = RequestMethod.GET,param = {"id"})
    public RespEntity ultrasonicDeviceDetail(@RequestBody(required = false) JSONObject jsonParam) {
        return ultrasonicService.ultrasonicDeviceDetail(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 超声波设备分页列表
     * @Date Created in 17:16 2022/10/8
     * @Param [jsonParam]
     */

    @At(value = "ultrasonicDeviceListPage", method = RequestMethod.GET, param = { "page","limit"})
    public RespEntity ultrasonicDeviceListPage(@RequestBody(required = false) JSONObject jsonParam) {
        return ultrasonicService.ultrasonicDeviceListPage(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 超声波水表正常数据添加
     * @Date Created in 14:47 2022/10/9
     * @Param [jsonParam]
     */

    @At(value = "setNormalLog", method = RequestMethod.POST)
    public RespEntity setNormalLog(@RequestBody(required = false) JSONObject jsonParam) {
        return ultrasonicDeviceNormalLogService.setNormalLog(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 超声波水表数据分页列表
     * @Date Created in 17:16 2022/10/8
     * @Param [jsonParam]
     */

    @At(value = "ultrasonicDeviceNormalLogListPage", method = RequestMethod.GET, param = { "page","limit"})
    public RespEntity ultrasonicDeviceNormalLogListPage(@RequestBody(required = false) JSONObject jsonParam) {
        return ultrasonicDeviceNormalLogService.ultrasonicDeviceNormalLogListPage(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 获取今日累计流量测试接口
     * @Date Created in 17:16 2022/10/8
     * @Param [jsonParam]
     */
    @At(value = "getTodayValue", method = RequestMethod.GET)
    public void getTodayValue(@RequestBody(required = false) JSONObject jsonParam) {
         ultrasonicDeviceNormalLogService.getTodayValue();
    }

    /**
     * @Author YangYu
     * @Description 超声波水表比对数据
     * @Date Created in 10:29 2022/10/12
     * @Param [jsonParam]
     */

    @At(value = "compare", method = RequestMethod.POST)
    public RespEntity compare(@RequestBody(required = false) JSONObject jsonParam) throws ParseException {
        return ultrasonicDeviceNormalLogService.compare();
    }

}
